package com.ks.core.framework.cpsupload.demos.resp;

import java.util.Map;

// 统一响应对象（最终对外暴露的响应）
public class UnifiedResponse {
    private boolean success;
    private String code;
    private String message;
    private String operationType; // PAYMENT/REFUND/QUERY/CALLBACK
    private Map<String, Object> businessData;
    
    // 私有构造函数（强制使用生成器构建）
    private UnifiedResponse() {}
    
    // 生成器类
    public static class Builder {
        private final UnifiedResponse response = new UnifiedResponse();
        
        public Builder success(boolean success) {
            response.success = success;
            return this;
        }
        
        public Builder code(String code) {
            response.code = code;
            return this;
        }
        
        public Builder message(String message) {
            response.message = message;
            return this;
        }
        
        public Builder operationType(String type) {
            response.operationType = type;
            return this;
        }
        
        public Builder businessData(Map<String, Object> data) {
            response.businessData = data;
            return this;
        }
        
        public UnifiedResponse build() {
            return response;
        }
    }
    
    // Getter方法
    // ...
    
    @Override
    public String toString() {
        return "UnifiedResponse{" +
               "success=" + success +
               ", code='" + code + '\'' +
               ", message='" + message + '\'' +
               ", operationType='" + operationType + '\'' +
               ", businessData=" + businessData +
               '}';
    }
}